import "./App.css";
import React from "react";

function CustomTextInput(props) {
  return (
    <div>
      <input ref={props.inputRef} />
    </div>
  );
}
class Child extends React.Component {
  render() {
    return (
      <div>
        <input ref={this.props.inputRef} />
      </div>
    );
  }
}
class App extends React.Component {
  componentDidMount() {
    console.log("this.inputElement=>", this.inputElement);
    console.log("this.inputElement2=>", this.inputElement2);
  }
  ref_callback = (el) => {
    this.inputElement = el;
  };
  render() {
    return (
      <div>
        <CustomTextInput inputRef={this.ref_callback} />
        <Child inputRef={(el) => (this.inputElement2 = el)} />
      </div>
    );
  }
}

export default App;
